﻿using NHibernate;

namespace FT.Architecture.NHibernate.SessionManagement
{
    public interface ISessionProviderService
    {
        /// <summary>
        /// Get the current NHibernate session
        /// </summary>
        /// <returns></returns>
        ISession GetSession();

        /// <summary>
        /// Get the current stateless NHibernate session
        /// </summary>
        /// <returns></returns>
        IStatelessSession GetStatelessSession();

        /// <summary>
        /// Set the current NHibernate session
        /// </summary>
        /// <param name="session"></param>
        void SetSession(ISession session);

        /// <summary>
        /// Set the current stateless NHibernate session
        /// </summary>
        /// <param name="session"></param>
        void SetStatelessSession(IStatelessSession session);

        /// <summary>
        /// Determine whether there is a session currently in progress
        /// </summary>
        /// <returns></returns>
        bool HasSession();

        /// <summary>
        /// Determine whether there is a session currently in progress
        /// </summary>
        /// <returns></returns>
        bool HasStatelessSession();
    }
}